package com.xiaoshou.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xiaoshou.pojo.User;
import com.xiaoshou.util.EncryptPass;

@Service
@Transactional
public class UserService extends BaseService{

	public User verifyLogin(User user) {
		return getUserDao().verifyUser(user);
	}

	public void modifyUser(User user, String newpassword) {
		user.setPassword(EncryptPass.encryptPassTen(newpassword));
		getUserDao().updateUserPassword(user);
	}

	public List<String> findLucturers() {
		List<User> userList = getUserDao().findLecturers();
		
		List<String> l = new ArrayList<String>();
		for (User u : userList) {
			l.add(u.getUsername());
		}
		return l;
	}

}
